Skip to content

Conversation

SOHELAHMED7
Copy link
Contributor

@SOHELAHMED7 SOHELAHMED7 commented Feb 5, 2025

Fixes #75


Current issues:

            'paths' => [
                '/test' => new PathItem([
                    'get' => new Operation([
                        'security' => [new SecurityRequirement(['BearerAuth' => []])],
                    ])
                ])
            ]

yields

'paths' => Array &1 (
        '/test' => Array &2 (
            'get' => Array &3 (
                'security' => Array &4 (
                    0 => Array &5 (
                        'BearerAuth' => Array &6 ()
                    )
                )
            )
        )
    )


            'paths' => [
                '/test' => new PathItem([
                    'get' => new Operation([
                        'security' => [new SecurityRequirement(['BearerAuth'])],
                    ])
                ])
            ]

yields

'paths' => Array &1 (
        '/test' => Array &2 (
            'get' => Array &3 (
                'security' => Array &4 (
                    0 => Array &5 (
                        0 => 'BearerAuth'
                    )
                )
            )
        )
    )


            'paths' => [
                '/test' => new PathItem([
                    'get' => new Operation([
                        'security' => [
                            'BearerAuth' => new SecurityRequirement([])
                        ],
                    ])
                ])
            ]

yields

'paths' => Array &1 (
        '/test' => Array &2 (
            'get' => Array &3 (
                'security' => Array &4 (
                    0 => Array &5 ()
                )
            )
        )
    )

This PR fixes above issues as

            'paths' => [
                '/test' => new PathItem([
                    'get' => new Operation([
                        'security' => new SecurityRequirements([
                            'BearerAuth' => new SecurityRequirement([])
                        ]),
                    ])
                ])
            ]

yields

'paths' => Array &1 (
        '/test' => Array &2 (
            'get' => Array &3 (
                'security' => Array &4 (
                    'BearerAuth' => Array &5 ( )
                )
            )
        )
    )

@SOHELAHMED7 SOHELAHMED7 marked this pull request as ready for review March 17, 2025 10:59
@SOHELAHMED7 SOHELAHMED7 changed the title Draft: How to use Security and SecurityRequirement How to use Security and SecurityRequirement Mar 17, 2025
@cebe cebe added this to the 1.8.0 milestone Apr 23, 2025
@cebe cebe merged commit e691d93 into cebe:master May 7, 2025
26 checks passed
@cebe
Copy link
Owner

cebe commented May 7, 2025

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to use Security and SecurityRequirement
2 participants